package net.lastcoder.ifserver.terminate;

import net.lastcoder.ifserver.util.TextUtils;

import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggingEvent;

/**
 * auth: WenYF
 * date: 2016/11/23
 */
public class TerminateLogFilter extends Filter {
    @Override
    public int decide(LoggingEvent loggingEvent) {
        String name = loggingEvent.getLoggerName();
        //System.out.println("decide name: " + name + " message: " + (String)loggingEvent.getMessage());
        if (TextUtils.isEmpty(name)) {
            return Filter.DENY;
        } else {
            if (name.contains("mina.")) {
                return Filter.DENY;
            }
        }
        return Filter.NEUTRAL;
    }
}
